package com.meta.platform.area.define;

import lombok.Getter;
import org.springframework.util.CollectionUtils;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * java类简单作用描述
 *
 * @Title:
 * @Package: com.metafnt.config.intf.define.
 * @Author: M.simple
 * @Remark: The modified content
 * @CreateDate: 2020/7/17 3:39 下午
 * @Version: v2.0
 */
@Getter
public enum AreaStatusEnum {

	DEFAULT_CREATE(10, "默认创建"),
	EFFECTIVE(20, "有效"),
	FORBIDDEN(30, "禁用");

	AreaStatusEnum(Integer code, String name) {
		this.code = code;
		this.name = name;
	}

	public static AreaStatusEnum getAreaStatusByCode(Integer code) {
		
		List<AreaStatusEnum> matchTypes = Arrays.asList(AreaStatusEnum.values()).stream().filter(msgType ->msgType.code.equals(code)).collect(Collectors.toList());
		if(CollectionUtils.isEmpty(matchTypes)){

		}
		return matchTypes.get(0);
	}

	private Integer code;

	/**
	 * name
	 */
	private String name;
}
